//
//  ReceiveAwardCell.swift
//  SCA
//
//  Created by tjun on 2025/9/19.
//

import UIKit

struct ReceiveAwardModel {
    let valueDisp: String
    let amountDisp: String
    let title: String
    let icon: String
    let coin: String
    let valueRatio: String
}


class ReceiveAwardCell: BaseTableViewCell {
    
    var model: ReceiveAwardModel! {
        didSet {
            coinImageView.setImage(url: model.icon)
            amountLabel.text = model.valueDisp
            coinNameLabel.text = model.title
        }
    }

    private let coinNameLabel = UILabel(font: UIFontMediumMake(16), textColor: .white)
    private let amountLabel = UILabel(font: UIFontMediumMake(16), textColor: .white)
    private let coinImageView = UIImageView()

    override func setSubView() {
        super.setSubView()

        selectionStyle = .none
        backgroundColor = UIColorMake(0x2E323F)
 
        contentView.addSubview(coinImageView)
        coinImageView.snp.makeConstraints { make in
            make.left.equalTo(AppStyle.margin.left)
            make.centerY.equalToSuperview()
            make.width.height.equalTo(32)
        }
        
        contentView.addSubview(coinNameLabel)
        coinNameLabel.snp.makeConstraints { (make) in
            make.left.equalTo(coinImageView.snp.right).offset(8)
            make.centerY.equalToSuperview()
        }
        
        contentView.addSubview(amountLabel)
        amountLabel.snp.makeConstraints { (make) in
            make.right.equalTo(-AppStyle.margin.left)
            make.centerY.equalToSuperview()
        }
  
    }

}
